<script type="text/javascript">
<!--
function doAction (action) {
	var act = '';
	if (action == 'export') {
		act = 'tasks/exportCsv';
	}
	
	var form = jQuery('form');
	form.attr('action', act);
	form.submit();
}

//-->
</script>
<?php echo $this->Form->create('Task',array('action'=>'fdasfd'));?>
<input type="hidden" name="data[Sprint][selectedTasks]"/>
<div id="search">
	<?php echo $html->link(__('Add New Task',true), array('controller'=> 'tasks', 'action'=>'add'), array('class'=>'button')); ?>
	<?php echo $form->submit('Export to CSV',array('type'=>'button','class'=>'button','onclick'=>'doAction("export")'));?>
	<div class="element">Search By</div>
	<div class="element"><?php 
		echo $form->input('Task.taskKeyword',array('div'=>false,'label'=>false,'style'=>'width:200px;margin-top:6px'));
	?></div>
	<div class="element"><input type="button" value=" Go " class="submit" onclick="alert('Undercontruction please try later!');" /></div>
</div>

<div class="list_header">
	<?php
		echo $this->Paginator->counter(array(
			'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
		));
	?>
	<div class="pages">
		<?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>|
		<?php echo $this->Paginator->numbers();?>|
		<?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?></div>
	</div>
	<div id="container" class="clearfix">
	<table border="0" cellpadding="5" cellspacing="1" width="100%">
		<tr class="title">
			<td><?php echo $form->input('Task.currentSprint',array('div'=>false,'label'=>false,'type'=>'checkbox'));?></td>
			<td><?php echo $this->Paginator->sort('Task Name','Task.taskName');?></td>
			<td><?php echo $this->Paginator->sort('Status','Task.status_id');?></td>
			<td>Responsible</td>
			<td width="30px">Rel Point</td>
			<td width="20px">Estimated Hours</td>
			<td width="20px">Real Hours</td>
			<td width="20px">Items</td>
			<td width="20px">Value</td>
			<td width="20px">Un Value</td>
			<td width="70px"><span><?php __('Actions');?></span></td>
		</tr>
	<?php foreach ($tasks as $task):?>
	<tr class="<?php echo $status[$task['Task']['status_id']];?>">
		<td><?php echo $form->input('Task.currentSprint',array('div'=>false,'label'=>false,'type'=>'checkbox'));?></td>
		<td style="text-align:left;"><?php echo $this->Html->link($task['Task']['taskName'], array('controller' => 'tasks', 'action' => 'viewDetail', 'id:'.$task['Task']['id']));?></td>
		<td><?php echo $status[$task['Task']['status_id']]; ?>&nbsp;</td>
		<td><?php echo $task['ResUser']['firstName'];?>&nbsp; <?php echo $task['ResUser']['lastName'];?></td>
		<td><?php echo $task['Task']['relativePoint'];?></td>
		<td><?php echo $task['Task']['estimatedHour'];?></td>
		<td class="<?php echo ($task['Task']['realHour'] > $task['Task']['estimatedHour'])?"red":"";?>"><?php echo $task['Task']['realHour'];?></td>
		<td><?php echo $task['items'];?></td>
		<td><?php echo $task['value'];?></td>
		<td><?php echo $task['unValue'];?></td>
		<td class="actions">
			<?php echo $this->Html->link($html->image('icon/add.png'), array('controller' => 'tasks', 'action' => 'addItem', 'id:'.$task['Task']['id']),array('escape' => false));  ?>
			<?php echo $this->Html->link($html->image('icon/edit.png'), array('controller' => 'tasks', 'action' => 'edit', $task['Task']['id'],'page:'.$this->Paginator->current()),array('escape' => false)); ?>
			<?php echo $this->Html->link($html->image('icon/delete.png'), array('action' => 'delete', $task['Task']['id']),array('escape' => false), null, sprintf(__('Are you sure you want to delete %s?', true), $task['Task']['taskName'])); ?>
		</td>
	</tr>
<?php endforeach; ?>
		</table>
		</div>